package com.jie.myvhr.service;

import com.jie.myvhr.bean.Menu;
import com.jie.myvhr.common.HrUtils;
import com.jie.myvhr.mapper.MenuMapper;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author jie
 * @date 2019/6/28 -14:42
 */
@Service
@Transactional
@CacheConfig(cacheNames = "menus_cache")
public class MenuService {

    @Resource
    private MenuMapper menuMapper;

//    @Cacheable(key = "#root.methodName")
    public List<Menu> getAllMenu() {
        return menuMapper.getAllMenu();
    }
    public List<Menu> getMenusByHrId() {
        return menuMapper.getMenusByHrId(HrUtils.getCurrentHr().getId());
    }
}
